#!/usr/bin/perl -w
# This is a pseudo Perl file to test Kate's Perl syntax highlighting.
# TODO: this is incomplete, add more syntax examples!

sub prg($)
<beginfold id='4'>{</beginfold id='4'>
	my $var = shift;

	$var =~ s<beginfold id='5'>/</beginfold id='5'>bla<endfold id='5'></endfold id='5'><beginfold id='7'>/</beginfold id='7'>foo<endfold id='7'>/igs</endfold id='7'>;
	$var =~ s<beginfold id='5'>!</beginfold id='5'>bla<endfold id='5'></endfold id='5'><beginfold id='7'>!</beginfold id='7'>foo<endfold id='7'>!igs</endfold id='7'>;
	$var =~ s<beginfold id='5'>#</beginfold id='5'>bla<endfold id='5'></endfold id='5'><beginfold id='7'>#</beginfold id='7'>foo<endfold id='7'>#igs</endfold id='7'>;
	$var =~ tr/a-z/A-Z/;
	($match) = ($var =~ m<beginfold id='5'>/</beginfold id='5'>(.*?)<endfold id='5'>/igs</endfold id='5'>);

	$test = 2/453453.21;
	$test /= 2;

	print qq<beginfold id='2'>~</beginfold id='2'>d fsd fsdf sdfl sd<endfold id='2'>~</endfold id='2'>
	
	$" = <beginfold id='2'>'</beginfold id='2'>/<endfold id='2'>'</endfold id='2'>;
	
	$foo = <beginfold id='3'><<</beginfold id='3'>__EOF;
d ahfdklf klsdfl sdf sd
fsd sdf sdfsdlkf sd
<endfold id='3'>__EOF</endfold id='3'>

	$x = <beginfold id='2'>"</beginfold id='2'>dasds<endfold id='2'>"</endfold id='2'>;

	next if( $match eq <beginfold id='2'>"</beginfold id='2'>two<endfold id='2'>"</endfold id='2'> );
	next if( $match =~ <beginfold id='5'>/</beginfold id='5'>go<endfold id='5'>/i</endfold id='5'> );

	@array = (1,2,3);		# a comment
	@array = qw<beginfold id='6'>(</beginfold id='6'>apple foo bar<endfold id='6'>)</endfold id='6'>;
	push(@array, 4);
	%hash = (red => <beginfold id='2'>'</beginfold id='2'>rot<endfold id='2'>'</endfold id='2'>,
		blue => <beginfold id='2'>'</beginfold id='2'>blau<endfold id='2'>'</endfold id='2'>);
	print keys(%hash);
<endfold id='4'>}</endfold id='4'>

sub blah <beginfold id='4'>{</beginfold id='4'>
    my $str = <beginfold id='3'><<</beginfold id='3'> '    EOS';
        this is my string
        and it's continuation
<endfold id='3'>    EOS</endfold id='3'>

    $str = <beginfold id='2'>"</beginfold id='2'>hello world<endfold id='2'>"</endfold id='2'>;

    $str = <beginfold id='3'><<</beginfold id='3'> "    EOS";
        this is my string
        and it's continuation
<endfold id='3'>    EOS</endfold id='3'>
<endfold id='4'>}</endfold id='4'>

&blah;
prg(<beginfold id='2'>"</beginfold id='2'>test<endfold id='2'>"</endfold id='2'>);

# Bracket closures in RegExp patterns (bug #364866)
qr<beginfold id='5'>{</beginfold id='5'> ${var} aa{aa{a}a} aa*b?<endfold id='5'>}</endfold id='5'>;
qr<beginfold id='5'>(</beginfold id='5'>aa(a(a(a(b|c)a)a)a)aa*b?<endfold id='5'>)</endfold id='5'>;
s<beginfold id='5'>{</beginfold id='5'>aaa {aaa} a \x{A2} *b?<endfold id='5'>}</endfold id='5'><beginfold id='7'>{</beginfold id='7'>aa<endfold id='7'>}</endfold id='7'>;
s<beginfold id='5'>(</beginfold id='5'>aa(a(a(a(b|c)a)a)a)aa<endfold id='5'>)</endfold id='5'><beginfold id='7'>(</beginfold id='7'>aa<endfold id='7'>)</endfold id='7'>;

# Strings as scalar references (bug #348765)
$x = \<beginfold id='2'>'</beginfold id='2'>Reference of a String<endfold id='2'>'</endfold id='2'>;
$y = \<beginfold id='2'>"</beginfold id='2'>Reference of a String<endfold id='2'>"</endfold id='2'>;

# Variables that start with underscore (bug #355300)
$_variable
$_ # Reserved var.

for my $x ($hash-><beginfold id='4'>{</beginfold id='4'>arr<endfold id='4'>}</endfold id='4'>->@*) <beginfold id='4'>{</beginfold id='4'>
    for my $k (keys $k->%*) <beginfold id='4'>{</beginfold id='4'>
        ...
    <endfold id='4'>}</endfold id='4'>
<endfold id='4'>}</endfold id='4'>

# Highlight correctly operator // (bug #407327)
$x = ns // <beginfold id='2'>"</beginfold id='2'><endfold id='2'>"</endfold id='2'>;
print $x;
